package com.demo.mqtt.zigbee.entity.po.eigenUpload;

import com.demo.mqtt.zigbee.entity.po.StHead;
import lombok.extern.slf4j.Slf4j;
import javolution.io.Struct;

import java.nio.ByteOrder;

/**
 * @program: mqtt
 * @description: 波形上传
 * @author: liuYunKai
 * @create: 2021-03-29 08:51
 */
@Slf4j
public class EigenUpLoad extends Struct{
    public final StHead head = inner(new StHead());

    /**
     * sn
     */
    public final UTF8String SN = new UTF8String(10);

    /**
     * 特征值时间
     */
    public final Unsigned8[] eigenTime = array(new Unsigned8[7]);

    /**
     * 参数时间
     */
    public final Unsigned8[] paramTime = array(new Unsigned8[7]);

    /**
     * RSSI
     */
    public final Signed8 rssi = new Signed8();

    /**
     * 电压
     */
    public final Float32 voltage = new Float32();

    /**
     * 温度
     */
    public final Float32 temperature = new Float32();


    /**
     * 一定要加上这个，不然会出现对齐的问题
     * @return isPacked
     */
    @Override
    public boolean isPacked() {
        return true;
    }

    /**
     * 设置大小端
     * @return byteOrder
     */
    @Override
    public ByteOrder byteOrder() {
        return ByteOrder.LITTLE_ENDIAN;
    }
}
